const { ccclass, property } = cc._decorator;
import skillPage from './skillPageControl';
import SoundMgr from '../SoundMgr';

@ccclass
export default class skillLoadControl extends cc.Component {
    @property(cc.Node)
    emitlight: cc.Node = null;
    @property(cc.Label)
    title: cc.Label = null;
    @property
    index: number = 0;
    _SkillId: string = "";
    _skillPage: skillPage = null;
    _SoundMgr: SoundMgr = null;

    onLoad() {
        this.node.on(cc.Node.EventType.TOUCH_START, this.Unload, this);
    }
    init() {
        this.node.active = true;
        this.emitlight.active = true;
    }

    Unload() {
        this._SoundMgr.play("click1");
        this.node.active = false;
        this.emitlight.active = false;
        let param = gameHelper.getInstance().skillParam;
        param.a[this.index] = null;
        (param.b as string[]).push(this._SkillId);
        gameHelper.getInstance().skillParam = param;
        this._skillPage.setContentItem(this._SkillId);
        this._SkillId = null;
    }
}
